package calendario_teste;

import java.awt.Canvas;
import java.awt.Color;
import java.awt.Dimension;
import java.awt.Graphics;
import java.awt.Graphics2D;
import java.text.SimpleDateFormat;

public class TopCanvas extends Canvas {
	
	private Color colorTopRect = new Color(179, 204, 220);

	private int k_width=(140*7)+25;
	private int k_height=30;
	private String[] diasSemana={"Dom","Seg","Ter","Qua","Qui","Sex","Sab"};
	private boolean drawWeek=false;
	private String day = "Friday 11/03";
	
	public TopCanvas(){
		
		drawWeek=true;
		setSize(k_width,k_height);
	}
	public TopCanvas(String day){
		
		drawWeek=false;
		this.day=day;
		setSize(k_width,k_height);
	}
	
	public void paint(Graphics g){
		Graphics2D g2=(Graphics2D) g;
		g2.setColor(colorTopRect);
		g2.fillRect(0, 0, k_width, k_height);
		
		if(drawWeek){
			drawStringSemana(g2);
		}
		else{
			drawStringDay(g2);
		}
		g2.setColor(Color.black);
		g2.drawRect(0, 0, k_width, k_height);
			
	}
	
	public void drawStringSemana(Graphics2D g2){
		g2.setColor(Color.black);
		for (int i = 0; i < diasSemana.length; i++) {
			g2.drawString(diasSemana[i], (140*i)+60, 25);
		}
	}
	public void drawStringDay(Graphics2D g2){
		g2.setColor(Color.black);
		g2.drawString(day, k_width/3, 25);
		
	}
	
	public void setWidth(int width){
		this.k_width=width;
	}
	
}
